<template>
  <div class="container">
    <el-row class="mb10">
      <el-col :span="16">
        <div class="flex">
          <el-select
            v-model="data.searchParams.projectYear"
            placeholder="年份"
            style="width: 10%"
            @change-value="changeValue"
            clearable
          >
            <el-option
              :label="item.itemText"
              :value="item.itemValue"
              :key="item.itemValue"
              v-for="item in options.yearList"
            />
          </el-select>
          <SelectOption
            :options="options.unitnameList"
            :placeholder="'奖项种类'"
            @change-value="changeValue1"
          >
          </SelectOption>
          <div class="conUnitName">
            <el-cascader
              popper-class="gy-cascader"
              :options="data.orgAllList"
              :props="data.popupTreeProps"
              v-model="data.searchParams.applyUnitName"
              :show-all-levels="false"
              placeholder="申报单位"
              clearable
            >
              <template #default="{ data }">
                <el-tooltip
                  :disabled="data.name.length < 13"
                  class="item"
                  effect="dark"
                  :content="data.name"
                  placement="bottom-start"
                >
                  <span>{{ data.name }}</span>
                </el-tooltip>
              </template>
            </el-cascader>
          </div>

          <el-button class="ordinary" @click="search()">搜索</el-button>
        </div>
      </el-col>
      <el-col :span="8" align="right">
        <el-button class="ordinary" @click="getExport()" v-limit="'KJSL:PTJCJS:KJZYZHPT:EXPERT'"
          >批量导出</el-button
        >
      </el-col>
    </el-row>
    <span style="font-weight: bold">奖励奖金合计：{{ data.bonussum }}(万元)</span>
    <div>
      <Table
        :loading="data.isLoading || data.detail_loading"
        :tableArr="data.allTableData"
        :pagination="data.page"
        :columns="data.columns"
        :total="data.page.total"
        @delectTable="delectIds"
        @currentChange="currentChange"
      >
        <template #operate="{ row }">
          <div>
            <el-button
              size="small"
              class="ordinary"
              @click="handleEdit(row)"
              v-limit="'KJSL:KJJL:KJCGJL:EDIT'"
              >分配奖金</el-button
            >
          </div>
        </template>
      </Table>
    </div>
    <el-dialog
      v-model="data.dialogVisible"
      width="900px"
      :show-close="false"
      :close-on-click-modal="false"
      @closed="close"
      destroy-on-close
    >
      <template #title>
        <div class="my-header" v-loading="data.detailVisible_loading">
          <el-tabs v-model="activeName" class="demo-tabs">
            <el-tab-pane label="分配奖金" name="first">
              <div v-if="data.dialogVisible">
                <Research
                  :orgAllList="orgAllList"
                  :members="data.diaForm.researchProjectList"
                  @paramsChange="getResarchInfo"
                  :bonusdandu="data.bonusdandu"
                  :defaultList="data.defaultList"
                ></Research>
              </div>
            </el-tab-pane>
          </el-tabs>
        </div>
      </template>

      <template #footer>
        <div class="dialog-footer" v-if="data.status == 0">
          <el-button @click="handleClose">关闭</el-button>
          <el-button type="primary" @click="sure">保存</el-button>
        </div>
        <div class="dialog-footer" v-if="data.status == 1" style="margin-top: 20px">
          <el-button @click="handleClose">关闭</el-button>
          <el-button type="primary" @click="handlebh">驳回</el-button>
          <el-button type="primary" @click="handletg">通过</el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>
<script lang="js">
import flowChart from '@/components/PublicProcess/Chart/flowChart.vue'
import * as proxy from "@/constants/proxy"
import request from "@/utils/request"
import Api from '@/views/science/api/awards'
import platformFiles from '@/views/science/components/platformFiles/platformFiles.vue'
import platformFilesxq from '@/views/science/components/platformFiles/platformFilesxq.vue'
import record from '@/views/science/components/record/record.vue'
import SelectOption from '@/views/science/components/selectOption'
import Table from '@/views/science/components/table/table.vue'
import { Modals, tips } from '@/views/science/components/tips/tips'
import { ElMessage } from 'element-plus'
import {computed, onMounted, reactive, ref} from 'vue'
import { useStore } from 'vuex'
import Research from './research.vue';
import Information from './information.vue'
import Informationxq from './informationxq.vue'

import {downloadFile} from "@/utils/utils";


export default {
  components: {
    SelectOption,
    flowChart,
    Table,
    platformFiles,//附件
    platformFilesxq,//附件
    Information,//基本信息
    Informationxq,//基本信息
    Research,//分配奖金
    record,//变更记录
  },
  setup() {
    const store = useStore()
    const startDate = ref(null);  // 开始时间绑定值
    const endDate = ref(null);  // 结束时间绑定值
    const activeName = ref('first')//tab切换
    const editValue = ref() //分配的数据
    const ruleForm = reactive({
      remark1: '',
    })

    const rules = reactive({
      remark1: [
        { required: true, message: '请输入备注', trigger: 'change', },
      ]
    })

    const ruleFormRef = ref()
    let data = reactive({
      orgAllList: [],
      popupTreeProps: {
        label: 'name',
        children: 'children',
        value:'id',
        checkStrictly: true,
      },
      times: null,
      taskId: '',
      businessKey: '',
      dealVisible: false,
      isLoading: false,
      detail_loading: false,
      constructionName: '',
      processInstanceId: '',
      changeLogs: [],//变更记录
      addFlag: 0,
      flag1: null,
      flag2: null,
      status: 0, //0编辑，1审核
      dialogVisible: false,//弹窗
      page: { page: 1, limit: 10, total: 0 },
      ids: [],
      time: [],
      searchParams: {
        // projectYear: '2024', // 年份
        awardApplyName: '', // 申报奖项
        applyUnitName: '',
        "projectName": "",
        "applyClass": "",
        "startTime": "",
        "endTime": "",
        "page": 1,
        "pageSize": 10,
        "remark1":"1",
      },
      processInstanceIdtwo:'',
      bonus:'',
      allTableData: [],
      columns: [
/*        {
          key: 'projectNo',
          width: 140,
          label: '项目编号',
        },*/
        {
          key: 'projectYear',
          width: 140,
          label: '年份',
        },
        {
          key: 'relateName',
          width: 140,
          // label: '项目名称',
          label: '名称',
        },
        {
          key: 'applyClass',
          width: 140,
          label: '奖项种类',
        },
/*        {
          key: 'awardApplyName',
          width: 140,
          label: '申报奖项',
        },*/
        {
          key: 'applyUnitName',
          width: 140,
          label: '申报单位',
        },
/*        {
          key: 'grade',
          width: 140,
          label: '等级',
        },
        {
          key: 'bonusStandard',
          width: 140,
          label: '奖金标准',
        },*/
        {
          key: 'ranking',
          width: 140,
          label: '中咨集团排名',
        },
        {
          key: 'bonus',
          width: 140,
          label: '奖金（万元）',
          textColor: true
        },
/*        {
          key: 'remark1',
          width: 140,
          label: '备注',
          textColor: true
        },*/
      ],
      pants: [],
      users: [],
      fileList: [], //附件信息
  
      awardSelect: {
        sbjx: 1,
        sblx: 1,
        pants: {}, //附表信息-科技创新成果奖-科学奖项
        patents: {}, //附表信息-科技创新成果奖-发明专利
        softwarecopyrights: {}, //科技创新成果奖-软件著作权
        technicalnorms: {}, //科技创新成果奖-技术标准
        technicalmethods: {}, //科技创新成果奖-技术工法
        composition: {}, //科技创新成果奖-学术著作
        thesis: {}, //科技创新成果奖-学术论文
        projects: {}, //重大科技项目立项奖
        innovate: {}, //创新平台建设奖
      },
      zlData: {},
      detailVisible_loading:false,
      detailVisible: false,
      currentRow:{},
      bonussum:0,
      bonusdandu:0,
      diaForm: {
        researchProjectList: [],
      },
      defaultList: []
    })
    const bonusdandulist = ref((data.bonussum).toFixed(6))
    let getResarchInfo = (parms) => {
      console.log(parms,'parms');
      data.diaForm.researchProjectList = parms

    }
    //详情数据获取
    const detailVisibleData = async (id) => {
      data.detailVisible_loading = true
      data.detailVisible = true

      Api.detailData({
        id: id
      })
          .then((res) => { // 获取列表数据
            const resData = res.data.data
            store.commit('technologyStrength/getachievementINFO', { ...resData.baseInfo })
            // store.commit('technologyStrength/getfbxxINFO', { ...resData.pants })
            data.users = res.data.data.users
            data.fileList = res.data.data.fileList
            data.changeLogs = res.data.data.changeLogs
            data.processInstanceIdtwo = resData.baseInfo.processInstanceId
            data.taskId = resData.baseInfo.currTaskTd
            data.softwarecopyrights = resData.softwarecopyrights
            data.awardSelect.pants = resData.pants
            //专利
            data.awardSelect.patents = resData.patents

            data.awardSelect.sbjx = resData.baseInfo.awardApplyId
            data.awardSelect.sblx = resData.baseInfo.applyClassId

            Object.assign(data.awardSelect, resData);
            // console.log('详情数据获取', data.awardSelect.projects);
            // data.addFlag = 1
            store.commit('technologyStrength/getAddFlag', 1)
            // ruleForm.comment = ''
            data.addFlag = 1
            data.detailVisible_loading = false
            // console.log('详情数据获取',resData);
          }).catch((error) => {
        data.detailVisible_loading = false
      })


    }
    const handleDetail = (row) => {
      data.currentRow = row
      detailVisibleData(row.id)
      store.commit('technologyStrength/getRowId', row.id)
      data.status = 0
      activeName.value = 'first'
    }

    const handleClose = () => {
      data.dialogVisible = false
      data.recordShow = false;
      activeName.value = 'first';
      ruleForm.remark1 ='';
    }
    const loading = ref(true)//加载
    // 存储下拉框数组的对象
    const options = reactive({
      projectnameList: computed(() => store.state.technologyStrength.KJSL_DECLARATION_TYPE),
      unitnameList: computed(() => store.state.technologyStrength.KJSL_APPLYING_FOR_AWARDS1),
      yearList: [
        { itemText: '全部年份', itemValue: '' },
        { itemText: '2026年', itemValue: '2026' },
        { itemText: '2025年', itemValue: '2025' },
        { itemText: '2024年', itemValue: '2024' },
        { itemText: '2023年', itemValue: '2023' },
        { itemText: '2022年', itemValue: '2022' },
        { itemText: '2021年', itemValue: '2021' },
        { itemText: '2020年', itemValue: '2020' },
        { itemText: '2019年', itemValue: '2019' },
        { itemText: '2018年', itemValue: '2018' },
      ],//年份
    })
    const changeValue = (item) => data.searchParams.projectYear = item.itemValue
    const changeValue1 = (item) => data.searchParams.awardApplyName = item.itemValue
    // 清除日期选择器,删除的时候将日期清空
    const dataPickerChange = () => {
      if (data.time) {
        data.searchParams.startTime = data.time[0];
        data.searchParams.endTime = data.time[1];
      } else {
        data.searchParams.startTime = null;
        data.searchParams.endTime = null;
        data.time = [];
      }
    };

    data.searchParams.page = data.page.page
    data.searchParams.pageSize = data.page.limit

    const getListData = () => { // 获取列表数据
      loading.value = true   // 加载
      data.isLoading = true
      let obj = {...data.searchParams}

      obj.applyUnitName = obj.applyUnitName ? obj.applyUnitName[obj.applyUnitName.length - 1] : ''
      Api.getbonusTotalList(obj)
        .then((res) => { // 获取列表数据
          let resData = res.data.data // 获取列表数据
          resData.records.map((item) => {
            if (item.status == 0) {
              item.status = "待提交"
            } else if (item.status == 1) {
              item.status = "办理中"
            } else if (item.status == 2) {
              item.status = "正常办结"
            } else if (item.status == 3) {
              item.status = "已退回"
            }
            else if (item.status == 4) {
              item.status = "已撤办"
            }
            else if (item.status == 5) {
              item.status = "强制办结"
            }
            else if (item.status == 6) {
              item.status = "已废弃"
            }
            else if (item.status == 7) {
              item.status = "已挂起"
            }
            else if (item.status == 8) {
              item.status = "已驳回"
            }
            item.applyTime = new Date(item.applyTime).getFullYear() + `-` + (new Date(item.applyTime).getMonth() + 1) + `-` + new Date(item.applyTime).getDate()
          })
          data.allTableData = resData.records   // 获取列表数据
          let dddd = resData.records[0].bonussum
          data.bonussum = dddd
          data.page.total = resData.total   // 获取列表数据
          data.isLoading = false
        })
        .finally(() => { // 获取列表数据
          loading.value = false  // 获取列表数据
        }).catch(() => {
          data.isLoading = false
        })
    }

    const closeVisable = () => {

      ruleFormRef.value.resetFields();
      data.dialogVisible = false



    }

    //详情数据获取
    const detailData = async (id) => {
      data.detail_loading = true

      Api.detailData({
        id: id
      })
        .then((res) => { // 获取列表数据
          const resData = res.data.data
          store.commit('technologyStrength/getachievementINFO', { ...resData.baseInfo })
          // store.commit('technologyStrength/getfbxxINFO', { ...resData.pants })
          data.users = res.data.data.users
          ruleForm.remark1 = resData.baseInfo.remark1
          Object.assign(data.awardSelect, resData);
          // console.log('详情数据获取', data.awardSelect.projects);
          // data.addFlag = 1
          store.commit('technologyStrength/getAddFlag', 1)
          // ruleForm.comment = ''
          data.addFlag = 1
          data.detail_loading = false
          // console.log('详情数据获取',resData);
        }).catch((error) => {
          data.detail_loading = false
        })
    }

    // 点击查询按键，分页设置为当前页为1，
    const search = () => {
      console.log('搜索',data.searchParams);
      data.page.page = 1
      getListData()
    }

    // 删除
    const deleteList = () => {


      if (data.ids.length) {
        Modals('是否删除选择内容', '提示', 'warning').then(async () => {
          let list = []
          data.allTableData.forEach(e => {
            if (data.ids.includes(e.id)) {
              list.push(e.status)
            }
          })
          console.log('删除', list);
          if (list.includes('办理中') || list.includes('正常办结') || list.includes('已退回') || list.includes('已撤办') || list.includes('强制办结') || list.includes('已废弃') || list.includes('已挂起')) {
            tips('只允许删除待提交和已驳回状态的数据', 'warning')
          } else {
            // console.log('可以删除');
            let res = await Api.deleteList({
              id: data.ids + ''
            })
            if (res.data.success) {
              tips('删除成功', 'success')
              getListData()
            }
          }

        }).catch(() => {
          console.log("点击了取消")
        })
      } else {
        tips('请选择', 'warning')
      }
    }

    const valueFlag1 = (flag) => {
      data.flag1 = flag
    }
    const valueFlag2 = (flag) => {
      data.flag2 = flag
    }



    const awardType = (awardSelect) => {
      Object.assign(data.awardSelect, awardSelect)
      Object.assign(data.zlData, awardSelect)
      console.log('关联对象切换', awardSelect)
    }

    const paramsChange = (params) => {
      console.log(params)
      data.awardSelect.technicalmethods = params
    }

    const paramsChange1 = (params) => {
      console.log(params)
      data.awardSelect.technicalnorms = params
    }

    const paramsChange2 = (params) => {
      // console.log(params)
      data.awardSelect.softwarecopyrights = params
    }
    //专利
    const paramsChange22 = (params) => {
      // console.log(params)
      data.awardSelect.patents = params
    }

    const paramsChange4 = (params) => {
      console.log(params)
      data.awardSelect.thesis = params
    }

    const paramsChange5 = (params) => {
      console.log(params)
      data.awardSelect.composition = params
    }

    const paramsChange6 = (params) => {
      data.awardSelect.pants = params
    }

    const paramsChange8 = (params) => {
      data.awardSelect.projects = params
    }

    const paramsChange9 = (params) => {
      console.log(params)
      data.awardSelect.innovate = params
    }

    const delectIds = (ids) => {
      data.ids = ids
    }

    const currentChange = (current) => {
      data.searchParams.page = current
      getListData()
    }

    const dataChange = () => {//附件
      console.log(1)
    }

    const filesParams = (params) => {
      data.fileList = params
    }

    const usersChange = (params) => {
      data.users = params
    }

    //修改
    const handleEdit = (row) => {
      store.commit('technologyStrength/getRowId', row.id)
      detailData(row.id)
      data.status = 0
      data.addFlag = 1
      data.bonusdandu = row.bonus
      activeName.value = 'first'
      data.diaForm.researchProjectList = []
      editValue.value = row
      Api.getBonus({
        id: row.id,
        page: 1,
        pageSize: 10,
        remark1: '0'
      }).then((res) => {
        if(res.data.success){
          data.dialogVisible = true
          try {
            data.defaultList = res.data.data.records
          } catch (error) {
            data.defaultList = []
          }
        }
      })
    }


    let handletj = (row) => {

      Modals("是否确认当前流程", "提示", "warning")
        .then(async () => {
          let res = await Api.startProcess({
            flowKey: 'tea1',
            businessKey: row.id,
            businessType: 'YW01',
            random: (new Date()).valueOf()
          });


          if (res.data.code == 200) {

            data.dealVisible = true

            deal(row.id, 1)

          } else {

            tips(res.data.message, 'warning')

          }

        })
    }

    //审核
    const handlesh = (row) => {
      const form = store.state.technologyStrength.achievementINFO
      activeName.value = 'four'
      store.commit('technologyStrength/getRowId', row.id)
      data.status = 1
      data.addFlag = 1
      data.businessKey = row.id
      // detailData(row.id)
      detailVisibleData(row.id)

    }

    //驳回
    const handlebh = () => {
      const form = store.state.technologyStrength.achievementINFO
      getAssociation.value.submitForm();
      ruleFormRef.value.validate(valid => {
        if (valid) {

          Modals('是否驳回本次内容', '提示', 'warning').then(async () => {
            let res = await Api.refuseProcess({
              procInsId: data.processInstanceId,
              // comment: ruleForm.comment,
              remark: form.bonus,
              businessKey: data.businessKey,
              businessType: 'YW01',
              random: (new Date()).valueOf()
            })
            if (res.data.code == 200) {

              ruleFormRef.value.resetFields();
              data.dialogVisible = false
              data.dealVisible = true
              deal(data.businessKey, 8)

            } else {
              tips(res.data.message, 'warning')
            }

          }).catch(() => {
            console.log("点击了取消")
          })
        }
      })
    }

    let deal = (id, state) => {
      data.times = setInterval(() => {
        Api.detailData({
          id: id
        })
          .then((res) => {
            const resData = res.data.data
            if (resData.baseInfo.status == state) {
              data.dealVisible = false
              getListData()
              clearTimeout(data.times)
            }
          })
      }, 1000);
    }

    //通过
    const handletg = () => {
      const form = store.state.technologyStrength.achievementINFO
      getAssociation.value.submitForm();

      ruleFormRef.value.validate(valid => {
        if (valid) {

          Modals('是否通过本次内容', '提示', 'warning').then(async () => {
            let res = await Api.allowProcess({
              procInsId: data.processInstanceId,
              // comment: ruleForm.comment,
              remark: form.bonus,
              businessKey: data.businessKey,
              businessType: 'YW01',
              random: (new Date()).valueOf()
            })

            if (res.data.code == 200) {
              data.dialogVisible = false
              data.dealVisible = true
              dealCheck(data.businessKey)

            } else {

              tips(res.data.message, 'warning')

            }

          }).catch(() => {
            console.log("点击了取消")
          })
        }
      })
    }



    let dealCheck = (id) => {
      data.times = setInterval(() => {
        Api.detailData({
          id: id
        })
          .then((res) => {
            let resData = res.data.data
            if (resData.baseInfo.status == 2) {
              data.dealVisible = false
              getListData()
              clearTimeout(data.times)
            }

            if (resData.baseInfo.status == 1 && resData.baseInfo.currTaskTd !== data.taskId) {
              data.dealVisible = false
              ruleFormRef.value.resetFields();
              getListData()
              clearTimeout(data.times)
            }

          })

      }, 1000);
    }

    const getExport = () => {
      let msg = '是否导出全部数据'
      if (data.ids.length > 0) {
        msg = '是否导出所选数据'
      }
      Modals(msg, '提示', 'warning').then(async () => {
        const params = {
          ...data.searchParams,
          ids: data.ids
        }
        await Api.exportShares(params, "奖金分配")
      }).catch(() => {
        console.log("点击了取消")
      })
    }



    //撤销
    const handlecx = (row) => {
      Modals('是否撤销审核通过的内容', '提示', 'warning').then(async () => {
        let res = await Api.rollback({
          id: row.id
        })
        if (res.data.success) {
          tips('撤销成功', 'success')
          getListData()
        }
      }).catch(() => {
        console.log("点击了取消")
      })
    }

    const add = () => {
      store.commit('technologyStrength/getAddFlag', 0)
      data.addFlag = 0
      data.dialogVisible = true //弹窗
      data.status = 0
      activeName.value = 'first'
      data.awardSelect.sbjx = 1
      data.awardSelect.sblx = 1
      store.commit('technologyStrength/emptyachievementINFO')
    }

    const close = () => {
      data.addFlag = 0
      data.dialogVisible = false
      data.fileList = []
      data.awardSelect.sbjx = 0
      data.awardSelect.sblx = 0
    }
    const getAssociation = ref()
    const getMiddle = ref()

    const getUnit = () => {

      return request({
        url: proxy.CHECC_API_CMS + "/org/getSysOrgList",
        method: "get",
      }).then(res => {
        data.orgAllList = res.data.data
      })
    }

    const updatemoban = async () => { // 确定
      const form = store.state.technologyStrength.achievementINFO
      getAssociation.value.submitForm()
      const mingzitou = form.awardApplyName
      const mingziwei = form.applyClass
      /*      Modals('是否下载模版', '提示', 'warning').then(async () => {
              const form = store.state.technologyStrength.achievementINFO
              getAssociation.value.submitForm()
              const params = {
                id: form.id
              }

              const mingzitou = form.awardApplyName
              const mingziwei = form.applyClass
              await Api.updatemb(params,mingzitou + mingziwei)*/
        Modals('是否下载模版', '提示', 'warning')
            .then(async () => {
              loading.value = true;

              return request({
                url: proxy.CHECC_API_CMS + "/kgptKjslTawardTechresult/template",
                method: "post",
                responseType: "blob",
                data: {
                    id: form.id
                },
              })
                  .then((res) => {
                    const name = mingzitou+mingziwei+'.docx';
                    const url = URL.createObjectURL(res.data);
                    downloadFile(url, name);
                  })
                  .finally(() => {
                    loading.value = false;
                  });
            })
            .catch(() => {
              console.log("点击了取消");
            });
    };
    const sure = async () => { // 确定
      let list = data.diaForm.researchProjectList
      if (list.length < 1) {
        tips("需要至少一条数据", "warning");
        // // event.stopPropagation();
        return false;
      } else {
        let panduan = -1
        list.forEach((item) => {
          for (let i = 0; i < list.length; i++) {
            if (item.expertName == null || item.expertName == '') {
              panduan = 0
            }
            if (item.workUnitName == null || item.workUnitName == '') {
              panduan = 1
            }
            if (item.workContent == null || item.workContent == '') {
              panduan = 2
            }
          }
        })
        if (panduan == 1) {
          tips('数据中姓名不能为空', 'warning')
          // event.stopPropagation();
          return false
        } else 
        if (panduan == 1) {
          tips('数据中发薪单位不能为空', 'warning')
          // event.stopPropagation();
          return false
        } else if (panduan == 2) {
          tips('金额不能为空', 'warning')
          return false
        }
      }
      let num = eval(list.map(e => Number(e.workContent)).join('+'))
      let val = (Number(editValue.value.bonussum)*10000 - num).toFixed(2)
      console.log(list)
      if(Number(val) < 0) {
        tips('不能超过奖金总额', 'warning')
        return
      } 
      let param = list.map(e => {
        return {
          awardId: editValue.value.id,
          // bonussum: (Number(editValue.value.bonussum)*10000).toFixed(2),
          bonussum:(data.bonusdandu * 10000).toFixed(2),
          userName: e.expertName,
          userId: e.expertNameId,
          orgId: e.workUnitId,
          orgName: e.workUnitName,
          amount: e.workContent,
          status: 1,
          projectYear:editValue.value.projectYear
        }
      })
      console.log('获取得数据', param)
      let res = await Api.postBonusAdd(param)
      if (res.data) {
        tips('保存成功', 'success')
        getListData()  // 获取列表数据
        data.dialogVisible = false  // 弹窗
      }
    }
    const orgAllList = ref([]);
    const getOrgList = () =>{
      return request({
        url: proxy.CHECC_API_CMS + "/org/getSysOrgList",
        method: "get",
      }).then(res =>{
        orgAllList.value = res.data.data
      })
    }
    getListData()
    getUnit()
    // 发送请求
    onMounted(() => {
      // 获取单位信息
      getOrgList();
    });

    return {
      dealCheck,
      delectIds,
      deal,
      changeValue,
      changeValue1,
      currentChange,
      search,
      filesParams,
      usersChange,

      valueFlag1,
      valueFlag2,
      awardType,
      paramsChange,
      paramsChange1,
      paramsChange2,
      paramsChange4,
      paramsChange5,
      paramsChange6,
      paramsChange8,
      paramsChange9,

      dataChange,
      getAssociation,
      activeName,
      options,
      data,
      ruleForm,
      rules,
      ruleFormRef,

      handleEdit,
      handletj,
      handlesh,
      handlecx,
      handlebh,
      handletg,
      closeVisable,
      // 列表
      getListData,
      // 新增
      add,
      sure,
      deleteList,
      startDate,
      endDate,
      getMiddle,
      dataPickerChange,
      getExport,
      close,
      paramsChange22,
      handleDetail, //详情
      handleClose, //详情
      updatemoban,
      getResarchInfo,
      bonusdandulist,
      orgAllList,
    }
  },
}
</script>
<style lang="scss" scoped>
.container {
  background-color: white;
  padding: 20px;
}
.conUnitName {
  display: inline-block;
  margin-bottom: -10px;
  margin-right: 15px;
  padding-bottom: 10px;
  margin-top: -5px;
}
/deep/.el-dialog > .el-dialog__footer {
  position: relative;
  top: -10px;
}

:global(.el-dialog__body) {
  padding: 0;
}

.el-col {
  line-height: 40px;
}
.el-input--small .el-input__inner {
  //height: 42px !important;
  //line-height: 32px;
}
.el-form-item {
  .el-input {
    width: 100px;
    background-color: aliceblue;
  }

  .el-select {
    width: 100px;
  }
}

.custom-color {
  color: red !important;
  /* 确保优先级高于其他样式 */
}

.el-table th {
  background-color: #f0f0f0;
  /* 修改表头背景色 */
  color: #333;
  /* 修改表头文字颜色 */
}

/* .demo-tabs > .el-tabs__content {
  padding: 32px;
  color: #6b778c;
  font-size: 32px;
  font-weight: 600;
} */

.open-title {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
}

/deep/.el-dialog__body {
  display: block !important;
}

.mt15 {
  margin-top: 15px;
}

.mb10 {
  margin-bottom: 10px;
}

.tc {
  text-align: center;
}

.align-center {
  align-items: center;
}

.space-between {
  justify-content: space-between;
}

.mt20 {
  margin-top: 20px;
}

.flex {
  display: flex;
  //height: 42px ;
}
</style>
